import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

//import java.util.ArrayList;
//import java.util.StringTokenizer;
//import java.util.Scanner;

/*
Written by			Matrikel Number
Yannic Remmet			196983
Tobias Trabelsi			197112
Anna-Katharina Wickert	197122
*/


public class FatCat {
		public static void main(String args[]){ 
			/*System.out.print("Geben Sie den zu permutierenden String ein: ");
			Scanner scan = new Scanner(System.in);
			String s=scan.nextLine();*/
			String[] st = {"The ", "Fat ", "Cat "};
			File outputFile = new File("cat.dat");
			try {
				outputFile.createNewFile();
				FileWriter out;
				out = new FileWriter(outputFile);
			} catch (IOException e) {
				e.printStackTrace();
			}
			maxIndex = st.length-1;
			//StringTokenizer st = new StringTokenizer(s);
			feld = st;
			perm(feld, maxIndex);
	  } 

	  static int maxIndex;
	  static String[] feld;

	  static void result(String[] a){		//20 Coffee later...
		 for (int i=0; i<=maxIndex; i++) 
		 System.out.print(a[i]);
	     System.out.println(" ");
	  }

	  static void change(String[] a, int i, int j){
	     String ablage = a[i];
	     a[i] = a[j];
	     a[j] = ablage;
	  }

	  static void perm(String[] a, int endIndex){
	     if (endIndex==0){
	            result(a);
	     }
	     else { perm(a, endIndex-1);
	            for (int i=0; i<=endIndex-1; i++)
	            {  //System.out.println("i: " + i + " a[0]: " + a[0] + " a[1]: " + a[1] + " a[2]: " + a[2]);
	            	change(a, i, endIndex);
	            	//System.out.println("i: " + i + " a[0]: " + a[0] + " a[1]: " + a[1] + " a[2]: " + a[2]);
	               perm(a, endIndex-1);
	               //System.out.println("i: " + i + " a[0]: " + a[0] + " a[1]: " + a[1] + " a[2]: " + a[2]);
	               change(a, i, endIndex);
	               //System.out.println("i: " + i + " a[0]: " + a[0] + " a[1]: " + a[1] + " a[2]: " + a[2]);
	            } // for i
	          }
	  }
	} 

	